

<script type="text/javascript">
$(document).ready(function(){

	
	
	
	
//////////////////////////////////////////////////
/////用户修改基本信息
//////////////////////////////////////////////////
    $.formValidator.initConfig({
        formid:"minfo",
        validatorgroup:"minfo"
    });

    $("#realname").formValidator({
        validatorgroup:"minfo",
        empty:true,
        tipid:'notetip',
        onshow:"请输入真实姓名",
        onfocus:"请输入真实姓名",
        oncorrect:" "
    }).inputValidator({
        min:4,
        max:8,
        empty:{leftempty:false,rightempty:false,emptyerror:"两边不能有空格"},
        onerror:"真实姓名最少2位"
    }).defaultPassed();

/*
    $("#userNickname").formValidator({
        validatorgroup:"minfo",
        onshow:"请输入您的昵称",
        onfocus:"请输入4到10位的昵称",
        oncorrect:"恭喜,您可以用这个昵称"
    }).inputValidator({
        min:4,
        max:10,
        empty:{leftempty:false,rightempty:false,emptyerror:"两边不能有空格"},
        onerror:"昵称的长度不对"
    }).ajaxValidator({
        type : "GET",
        datatype : "json",
        url : APP+"/Member/permodcheck/",
        success : function(data){
            if(data=="1"){return true;}else{return false;}
        },
        error: function(){alert("可能服务器忙，请重试");},
        onerror : "该昵称不可用，请更换",
        onwait : "进行合法性校验，请稍候..."
    });

*/







//////////////////////////////////////////////////
/////用户修改密码
//////////////////////////////////////////////////
    $.formValidator.initConfig({
        formid:"mpwd",
        validatorgroup:"mpwd"
    });

    $("#oldPassword").formValidator({
        validatorgroup:"mpwd",
        onshow:"请输入旧密码",
        onfocus:"密码最少7位,不能全数字",
        oncorrect:"密码合法"
    }).inputValidator({
        min:7,
        empty:{leftempty:false,rightempty:false,emptyerror:"两边不能有空格"},
        onerror:"密码最少7位"
    });

    $("#userPassword").formValidator({
        validatorgroup:"mpwd",
        onshow:"请输入新密码",
        onfocus:"密码最少7位且不能全为数字",
        oncorrect:"密码合法"
    }).inputValidator({
        min:7,
        empty:{leftempty:false,rightempty:false,emptyerror:"两边不能有空格"},
        onerror:"密码最少7位"
    }).regexValidator({
        regexp:"^(?!\\d*$)",
        onerror:"密码不能全数字,请检查"
    });

    $("#userPasswordRepeat").formValidator({
        validatorgroup:"mpwd",
        onshow:"请输入重复密码",
        onfocus:"两次密码必须一致哦",
        oncorrect:"密码一致"
    }).inputValidator({
        min:7,
        empty:{leftempty:false,rightempty:false,emptyerror:"两边不能有空格"},
        onerror:"密码最少7位"
    }).compareValidator({
        desid:"userPassword",
        operateor:"=",
        onerror:"2次密码不一致"
    });

});








/**
 * 用户密码修改
 */
function mpwd() {
    var pass=$.formValidator.pageIsValid('mpwd');
    if(pass){
        var queryString = $('#mpwd').formSerialize();
        //alert(queryString);
        $.post(APP+"/Member/mb_modify_pwd", queryString,function(msg){
            if(msg=='0'){ //先保留msg这个值以备以后使用
                showtips('用户密码修改成功!','mpwdtips',1);
            }else{
                showtips(msg,'mpwdtips',2);
            }
        });
    }
}




/**
 * 用户logo修改
 */
function mlogo() {
      var queryString = $('#mlogo').formSerialize();
    //alert(queryString);
      $.post(APP+"/Member/mb_modify_logo", queryString,function(msg){
          if(msg=='0'){ //先保留msg这个值以备以后使用
              showtips('用户头像修改成功!','mlogotips',1);
          }else{
              showtips(msg,'mlogotips',2);
          }
      });

}



/**
 * 用户info修改
 */
function minfo() {
    var pass=$.formValidator.pageIsValid('minfo');
    if(pass){
        var queryString = $('#minfo').formSerialize();
        //alert(queryString);
        $.post(APP+"/Member/mb_modify_info", queryString,function(msg){
            if(msg=='0'){ //先保留msg这个值以备以后使用
                showtips('用户信息修改成功!请重新登陆!','minfotips',1);
                logout();//修改用户信息后马上退出
            }else{
                showtips(msg,'minfotips',2);
            }
        });
    }
}




</script>





<!-- 个人信息 -->
<!-- #minfo -->
<div class="container clearfix">
    <div class="tabview">
        <h2 class="title fl">基本信息</h2>
    </div>

    <form id="minfo">
	    <div id="basicInfo" class="content clearfix" style="display:block;">
	
	        <div class="inputWrap">
	            <label for="userNickname">昵称:</label>
	            <input id="userNickname" name="nickname" type="text" class="input" style="width:150px;" value="{$user.name}"   disabled='disabled' />
	        </div>
	
	        <div class="inputWrap fl">
	            <label >真实姓名:</label>
	            <input id="realname" name="realname" type="text" class="input" style="width:150px;" value="{$user.realname}" />
	        </div>
	    
	        <div class="inputWrap fl cl">
	            <label>性别:</label>
	            <select  name="sex" id="sex" class="select" style=" width:96px;">
	                <option value="0" <eq name="user['sex']" value="0">selected</eq>>先生</option>
	                <option value="1" <eq name="user['sex']" value="1">selected</eq>>女士</option>
	            </select>
	        </div>
	
	        <div class="inputWrap fl">
	            <label>生日:</label>
	            <input id="birthday" name="birthday" type="text" class="input" style="width:80px;" value="{$user.birthday|date='Y-m-d',###}" onclick="WdatePicker();"/>
	        </div>
	
	        <div class="cb">
	            <span class="button">
	                <span class="first-child">
	                    <button  onclick="javascript:minfo();" class="strong" type="button">确认修改</button>
	                </span>
	            </span>
	        </div>
	
	        <span id="minfotips"></span>
	
	    </div>
    </form>
    
    
    <form id="mlogo">
	    <div id="userIcon" class="content clearfix" style="display:block;">
	        <div id="userIconSelected">
	            <a href="javascript:usericon();" onfocus="this.blur()"><img id="showicon" src="__PUBLIC__/images/head/b/{$user.head}" /></a>
	        </div>
	        <div class="cb" style="width:200px;">
	            <span class="button">
	                <span class="first-child">
	                    <button  onclick="javascript:mlogo();" class="strong" type="button">确认修改</button>
	                </span>
	            </span>
	            <span id="mlogotips"></span>
	        </div>
	        <input type="hidden" id="photo" name="photo" value="__PUBLIC__/images/head/b/{$user.head}"> 
	    </div>
    </form>
</div>
<!-- #minfo end -->


<!-- #mpwd -->
<div class="container">
    <div class="tabview">
        <h2 class="title fl">修改密码</h2>
    </div>
    <form id="mpwd">
	    <div class="content" style="display: block;">
	        <div class="inputWrap">
	            <label for="oldPassword">旧密码:</label>
	            <input id="oldPassword" name="oldPassword" type="password" class="input" style="width:201px;" />
	            <span id="oldPasswordTip"></span>
	        </div>
	        <div class="inputWrap">
	            <label for="userPassword">新密码:</label>
	            <input id="userPassword" name="userPassword" type="password" class="input" style="width:201px;" />
	            <span id="userPasswordTip"></span>
	        </div>
	        <div class="inputWrap">
	            <label for="userPasswordRepeat">重复密码:</label>
	            <input id="userPasswordRepeat" type="password" class="input" style="width:201px;" />
	            <span id="userPasswordRepeatTip"></span>
	        </div>
	        <span class="button">
	            <span class="first-child">
	                <button  onclick="javascript:mpwd();" class="strong" type="button">确认修改</button>
	            </span>
	        </span>
	
	        <span id="mpwdtips"></span>
	
	    </div>
   </form>
</div>
<!-- #mpwd end -->


